/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.fpt.entity;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author TuanAnh
 */
@Entity
@Table(name = "CheckStatusRoom")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CheckStatusRoom.findAll", query = "SELECT c FROM CheckStatusRoom c"),
    @NamedQuery(name = "CheckStatusRoom.findByRoomId", query = "SELECT c FROM CheckStatusRoom c WHERE c.checkStatusRoomPK.roomId = :roomId"),
    @NamedQuery(name = "CheckStatusRoom.findByCheckStatus", query = "SELECT c FROM CheckStatusRoom c WHERE c.checkStatusRoomPK.checkStatus = :checkStatus")})
public class CheckStatusRoom implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CheckStatusRoomPK checkStatusRoomPK;
    @JoinColumn(name = "roomId", referencedColumnName = "roomID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Room room;

    public CheckStatusRoom() {
    }

    public CheckStatusRoom(CheckStatusRoomPK checkStatusRoomPK) {
        this.checkStatusRoomPK = checkStatusRoomPK;
    }

    public CheckStatusRoom(String roomId, String checkStatus) {
        this.checkStatusRoomPK = new CheckStatusRoomPK(roomId, checkStatus);
    }

    public CheckStatusRoomPK getCheckStatusRoomPK() {
        return checkStatusRoomPK;
    }

    public void setCheckStatusRoomPK(CheckStatusRoomPK checkStatusRoomPK) {
        this.checkStatusRoomPK = checkStatusRoomPK;
    }

    public Room getRoom() {
        return room;
    }

    public void setRoom(Room room) {
        this.room = room;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (checkStatusRoomPK != null ? checkStatusRoomPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CheckStatusRoom)) {
            return false;
        }
        CheckStatusRoom other = (CheckStatusRoom) object;
        if ((this.checkStatusRoomPK == null && other.checkStatusRoomPK != null) || (this.checkStatusRoomPK != null && !this.checkStatusRoomPK.equals(other.checkStatusRoomPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.fpt.entity.CheckStatusRoom[ checkStatusRoomPK=" + checkStatusRoomPK + " ]";
    }
    
}
